/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ControlNotas.java
 *
 * Created on 11-jul-2012, 23:05:33
 */

package interfaz;
import Clases.Cursounidad;
import Clases.Nota;
import Controladores.CatedraticocursoJpaController;
import Controladores.CursoJpaController;
import Controladores.CursounidadJpaController;
import Controladores.NotaPersonalizado;
import escuela.conexion;
import escuela.exceptions.IllegalOrphanException;
import escuela.exceptions.NonexistentEntityException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.swing.JOptionPane;
import javax.swing.SpinnerNumberModel;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author PaBLo
 */
public class ControlNotas extends javax.swing.JDialog {
    short idcat = 1;
    Mensajes msj = new Mensajes(this);
    ArrayList idcursounidad = new ArrayList();
    conexion cnx = conexion.ObtenerInstancia();
    EntityManagerFactory emf = cnx.ObtenerEMF();
    NotaPersonalizado notas = new NotaPersonalizado(emf);
    CursounidadJpaController cursoUni = new CursounidadJpaController(emf);
    SpinnerNumberModel nnmd = new SpinnerNumberModel(0.0,0.0,100,0.1);//notaneta
    SpinnerNumberModel npmd = new SpinnerNumberModel(0.0,0.0,100,0.1);//notaporcentual
    SpinnerNumberModel ennmd = new SpinnerNumberModel(0.0,0.0,100,0.1);//editnotaneta
    SpinnerNumberModel enpmd = new SpinnerNumberModel(0.0,0.0,100,0.1);//editnotaporcentual
    ArrayList ids= new ArrayList();
    byte ban = 1;
    boolean haydatos = true;
    short id;
    //CatedraticocursoJpaController catcurso = new CatedraticocursoJpaController(emf);
    //CursoJpaController cursos = new CursoJpaController(emf);
    /** Creates new form ControlNotas
     * @param parent
     * @param idcatedratico
     * @param modal
     */
    public ControlNotas(java.awt.Frame parent, boolean modal,short idcatedratico) {
        super(parent, modal);
        initComponents();
        this.setLocationRelativeTo(null);
        this.Fecha.setCalendar(Calendar.getInstance());
        this.idcat=idcatedratico;
        CargarCursosUnidad();
        this.NotaNeta.setModel(nnmd);
        this.NotaPorcentual.setModel(npmd);
        this.EditNotaNeta.setModel(ennmd);
        this.EditNotaPorcentual.setModel(enpmd);
        if(notas.pTodasLasNotas().isEmpty()){
            haydatos=false;
        }else{
            boolean hay=false;
            ReporteNotas();
            int pos = 0;
            while(pos!=notas.getNotaCount()-1){
                Nota nt=notas.pBuscarxIndice(pos);
                if(nt.getCursounidad().getCatedraticocurso().getCatedratico().getIdCatedratico()==idcat){
                    id=(short) nt.getIdNota();
                    CargarDatosNota();
                    hay=true;
                }
                pos++;
            }
            if(hay){
                haydatos=true;
            }else{ haydatos=false;}
        }

    }
    /** Procedimiento para editar los datos de la nota
     */
    private void EditarNota(){
        short idcursouni = Short.parseShort(idcursounidad.get(this.EditCursoUnidad.getSelectedIndex()).toString());
        String act = this.EditActividad.getText();
        String desc = this.EditDescripcion.getText();
        String notaN =this.EditNotaNeta.getValue()+"";
        String notaP = this.EditNotaPorcentual.getValue()+"";
        Date fecha = this.EditFecha.getDate();
        Nota nueva = new Nota(id,act,desc,notaN.substring(0,3),notaP.substring(0,3),fecha);
        nueva.setCursounidad(cursoUni.findCursounidad(idcursouni));
        try {
            notas.destroy(id);
        } catch (IllegalOrphanException ex) {
            Logger.getLogger(ControlNotas.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NonexistentEntityException ex) {
            Logger.getLogger(ControlNotas.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(ControlNotas.class.getName()).log(Level.SEVERE, null, ex);
        }
        notas.create(nueva);
    }
    /** Procedimiento para mostrar las notas ya creadas
     */
    private void ReporteNotas(){
        int sel=this.BuscarX.getSelectedIndex();
        if(sel==0){
            List<Nota> repnota = notas.pTodasLasNotas();
            MiModelo modelo = new MiModelo();
            modelo.addColumn("Actividad");
            modelo.addColumn("Curso");
            modelo.addColumn("Unidad");
            modelo.addColumn("Ciclo");
            modelo.addColumn("Nota neta");
            modelo.addColumn("Fecha");
            Object[] filas = new Object [6];
            for(Nota nt:repnota){
                if(nt.getCursounidad().getCatedraticocurso().getCatedratico().getIdCatedratico()==idcat){
                    ids.add(nt.getIdNota());
                    filas[0]=nt.getActividad();
                    filas[1]=nt.getCursounidad().getCatedraticocurso().getCurso().getNombre();
                    filas[2]=nt.getCursounidad().getUnidad().getNombre();
                    SimpleDateFormat fecha1 = new SimpleDateFormat("yyyy");
                    filas[3]=fecha1.format(nt.getCursounidad().getCatedraticocurso().getCiclocurso().getAño());
                    filas[4]=nt.getNotaNeta();
                    SimpleDateFormat fecha = new SimpleDateFormat("dd/MM/yyyy");
                    filas[5]=fecha.format(nt.getFecha());
                    modelo.addRow(filas);
                }
            }
            this.ReporteNota.setModel(modelo);
        }
    }
    /** Procedimiento para cargar los datos de la nota seleccionada en el formulario
     */
    private void CargarDatosNota(){
        Nota nt = notas.findNota(id);
        this.EditActividad.setText(nt.getActividad());
        this.EditCursoUnidad.setSelectedIndex(nt.getCursounidad().getIdCursoUnidad()-1);
        System.out.println("-----:"+nt.getCursounidad().getIdCursoUnidad()+":------------");
        this.EditDescripcion.setText(nt.getDescripción());
        this.EditNotaNeta.setValue(Double.parseDouble(nt.getNotaNeta()));
        this.EditNotaPorcentual.setValue(Double.parseDouble(nt.getNotaPorcentual()));
        this.EditFecha.setDate(nt.getFecha());
    }
    /** Procedimiento para cargar el curso y unidad al que  se le va a asignar la nota
     */
    private void CargarCursosUnidad(){
        List<Cursounidad> curuni = cursoUni.findCursounidadEntities();
        for(Cursounidad cu: curuni){
            if(cu.getCatedraticocurso().getCatedratico().getIdCatedratico()==idcat){
                SimpleDateFormat fecha = new SimpleDateFormat("yyyy");
                String lista = cu.getUnidad().getNombre()+" - "+cu.getCatedraticocurso().getCurso().getNombre()+" ("+fecha.format(cu.getCatedraticocurso().getCiclocurso().getAño())+")";
                this.CursoUnidad.addItem(lista);
                this.EditCursoUnidad.addItem(lista);
                idcursounidad.add(cu.getIdCursoUnidad());
            }
        }
    }
    /** Procedimiento para ingresar una nota a la base de datos
     */
    private void IngresarNota(){
        short idcursouni = Short.parseShort(idcursounidad.get(this.CursoUnidad.getSelectedIndex()).toString());
        String act = this.Actividad.getText();
        String desc = this.Descripcion.getText();
        String notaN =this.NotaNeta.getValue()+"";
        String notaP = this.NotaPorcentual.getValue()+"";
        Date fecha = this.Fecha.getDate();
        Nota nueva = new Nota((short)notas.pUltimoId(),act,desc,notaN.substring(0,3),notaP.substring(0,3),fecha);
        nueva.setCursounidad(cursoUni.findCursounidad(idcursouni));
        notas.create(nueva);
    }
    // <editor-fold defaultstate="collapsed" desc="Verificacion de campos">
    private boolean VerificarCampos(byte panel){
        boolean respuesta =true;
        boolean[] campos = new boolean[2];
        if(panel==0){
            campos[0]=this.Actividad.getText().isEmpty();
            campos[1]=this.Descripcion.getText().isEmpty();
        }else {
            campos[0]=this.EditActividad.getText().isEmpty();
            campos[1]=this.EditDescripcion.getText().isEmpty();
        }
        int num=0;
        for(boolean cam: campos){
            if(cam==true){
                respuesta=false;
                break;
            }
            num++;
        }
        if(respuesta==false){
            System.out.print("entro");
            String mensaje="";
            switch(num){
                case 1: mensaje="La descripcion es obligatoria"; break;
                case 0: mensaje="El nombre de la activada es obligatorio"; break;
            }
            msj.MensajeError(mensaje);
        }
        return respuesta;
    }// </editor-fold>
    private void ReiniciarCampos(byte campo){
        if(campo==0){
            this.Descripcion.setText("");
            this.Actividad.setText("");
            this.NotaPorcentual.setValue(0);
            this.NotaNeta.setValue(0);
            this.Fecha.setCalendar(Calendar.getInstance());
        }else{
            //aqui va lo de editar
        }
    }
    private void Aceptar(){
        int seleccionado = this.CRUDiNota.getSelectedIndex();
        switch(seleccionado){
            case 0: if(VerificarCampos((byte)0)){
                        IngresarNota();
                        msj.MensajeSeRealizo("Se ha ingresado la nota correctamente", "Ingresada");
                        this.CursoUnidad.removeAllItems();
                        this.EditCursoUnidad.removeAllItems();
                        CargarCursosUnidad();
                        ReporteNotas();
                        id=(short)notas.pUltimoId();
                        CargarDatosNota();
                    }
                    break;
            case 1: if(VerificarCampos((byte)1)){//Edicion
                        byte respuesta =msj.MensajeConfirmacion("¿Esta seguro que desea actualizar los datos de esta nota?");
                        switch(respuesta){
                            case 0: EditarNota();
                                    msj.MensajeSeRealizo("Se ha actualizadola nota correctamente", "Actualizada");
                                    //CargarDatosNota();
                                    ReporteNotas();
                                    break;
                            case 2: System.out.println("Cancelar"); break;
                        }
                    }
                    break;
        }
    }
    private void Cancelar(){
        int seleccionado = this.CRUDiNota.getSelectedIndex();
        byte respuesta;
        switch(seleccionado){
            case 0: respuesta =msj.MensajeConfirmacion("¿Esta seguro que cancelar el ingreso? Todos los datos se perderan");
                    switch(respuesta){
                        case 0: ReiniciarCampos((byte)0); break;
                        case 2: System.out.println("Cancelar"); break;
                    }
                    break;
            case 1: respuesta =msj.MensajeConfirmacion("¿Esta seguro que desea cancelar la actualizacion? Todos los datos que no esten guardados se perderan");
                    switch(respuesta){
                        case 0: CargarDatosNota(); break;
                        case 2: System.out.println("Cancelar"); break;
                    }
                    break;
        }
    }
    /**
     *
     */
    public class MiModelo extends DefaultTableModel
    {
        @Override
       public boolean isCellEditable (int row, int column)
       {
           return false;
       }
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        CRUDiNota = new javax.swing.JTabbedPane();
        PanelCreacion = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        Actividad = new javax.swing.JTextField();
        Fecha = new com.toedter.calendar.JDateChooser();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        CursoUnidad = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        Descripcion = new javax.swing.JTextArea();
        NotaNeta = new javax.swing.JSpinner();
        NotaPorcentual = new javax.swing.JSpinner();
        PanelEdicion = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        EditCursoUnidad = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        EditDescripcion = new javax.swing.JTextArea();
        EditNotaNeta = new javax.swing.JSpinner();
        jLabel10 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        EditNotaPorcentual = new javax.swing.JSpinner();
        EditFecha = new com.toedter.calendar.JDateChooser();
        jLabel17 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        EditActividad = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        ReporteNota = new javax.swing.JTable();
        jLabel24 = new javax.swing.JLabel();
        BuscarX = new javax.swing.JComboBox();
        Cancelar = new javax.swing.JButton();
        Aceptar = new javax.swing.JButton();
        jTaskPane1 = new com.l2fprod.common.swing.JTaskPane();
        jLabel23 = new javax.swing.JLabel();
        Desc = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Control de Notas");
        setName("pNotas"); // NOI18N
        setResizable(false);

        CRUDiNota.setFont(new java.awt.Font("Arial", 0, 12));
        CRUDiNota.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                CRUDiNotaStateChanged(evt);
            }
        });

        PanelCreacion.setToolTipText("Crear y agregar un nuevo alumno");

        jLabel1.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel1.setText("Curso-Unidad:");
        jLabel1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jLabel1FocusGained(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel2.setText("Actividad:");

        jLabel3.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel3.setText("Descripcion:");

        jLabel4.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel4.setText("Nota neta:");

        jLabel5.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel5.setText("Nota porcentual:");

        jLabel7.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel7.setText("Fecha:");

        Actividad.setFont(new java.awt.Font("Arial", 0, 12));
        Actividad.setNextFocusableComponent(Descripcion);
        Actividad.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ActividadKeyPressed(evt);
            }
        });

        Fecha.setNextFocusableComponent(Cancelar);
        Fecha.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                FechaKeyPressed(evt);
            }
        });

        jLabel11.setForeground(new java.awt.Color(255, 0, 0));
        jLabel11.setToolTipText("Campo Obligatorio");
        jLabel11.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jLabel11FocusGained(evt);
            }
        });

        jLabel12.setForeground(new java.awt.Color(255, 0, 0));
        jLabel12.setText("*");
        jLabel12.setToolTipText("Campo Obligatorio");

        jLabel13.setForeground(new java.awt.Color(255, 0, 0));
        jLabel13.setText("*");
        jLabel13.setToolTipText("Campo Obligatorio");

        jLabel14.setForeground(new java.awt.Color(255, 0, 0));
        jLabel14.setText("*");
        jLabel14.setToolTipText("Campo Obligatorio");

        jLabel15.setForeground(new java.awt.Color(255, 0, 0));
        jLabel15.setText("*");
        jLabel15.setToolTipText("Campo Obligatorio");

        jLabel18.setForeground(new java.awt.Color(255, 0, 0));
        jLabel18.setText("*");
        jLabel18.setToolTipText("Campo Obligatorio");

        CursoUnidad.setFont(new java.awt.Font("Arial", 0, 12));
        CursoUnidad.setNextFocusableComponent(Actividad);
        CursoUnidad.setOpaque(false);

        Descripcion.setColumns(20);
        Descripcion.setFont(new java.awt.Font("Arial", 0, 12));
        Descripcion.setRows(5);
        Descripcion.setNextFocusableComponent(NotaNeta);
        Descripcion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                DescripcionKeyPressed(evt);
            }
        });
        jScrollPane1.setViewportView(Descripcion);

        NotaNeta.setNextFocusableComponent(NotaPorcentual);
        NotaNeta.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                NotaNetaKeyPressed(evt);
            }
        });

        NotaPorcentual.setNextFocusableComponent(Fecha);
        NotaPorcentual.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                NotaPorcentualKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout PanelCreacionLayout = new javax.swing.GroupLayout(PanelCreacion);
        PanelCreacion.setLayout(PanelCreacionLayout);
        PanelCreacionLayout.setHorizontalGroup(
            PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCreacionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelCreacionLayout.createSequentialGroup()
                        .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(PanelCreacionLayout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel3))
                            .addGroup(PanelCreacionLayout.createSequentialGroup()
                                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel1))))
                        .addGap(18, 18, 18)
                        .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE)
                            .addComponent(Actividad, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE)
                            .addComponent(CursoUnidad, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(PanelCreacionLayout.createSequentialGroup()
                        .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14)
                            .addComponent(jLabel15)
                            .addComponent(jLabel18))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel7)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(NotaNeta, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
                            .addComponent(NotaPorcentual, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
                            .addComponent(Fecha, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE))))
                .addContainerGap())
        );
        PanelCreacionLayout.setVerticalGroup(
            PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCreacionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(jLabel2)
                    .addComponent(jLabel12)
                    .addComponent(Actividad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(CursoUnidad))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jLabel13))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(NotaNeta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(NotaPorcentual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15))
                .addGap(8, 8, 8)
                .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelCreacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel7)
                        .addComponent(jLabel18))
                    .addComponent(Fecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        CRUDiNota.addTab("Crear", PanelCreacion);

        PanelEdicion.setToolTipText("Crear y agregar un nuevo alumno");

        jLabel6.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel6.setText("Curso-Unidad:");
        jLabel6.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jLabel6FocusGained(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel8.setText("Actividad:");

        EditCursoUnidad.setFont(new java.awt.Font("Arial", 0, 12));
        EditCursoUnidad.setNextFocusableComponent(EditActividad);
        EditCursoUnidad.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                EditCursoUnidadItemStateChanged(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel9.setText("Descripcion:");

        EditDescripcion.setColumns(20);
        EditDescripcion.setFont(new java.awt.Font("Arial", 0, 12));
        EditDescripcion.setRows(5);
        EditDescripcion.setNextFocusableComponent(EditNotaNeta);
        EditDescripcion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditDescripcionKeyPressed(evt);
            }
        });
        jScrollPane2.setViewportView(EditDescripcion);

        EditNotaNeta.setNextFocusableComponent(EditNotaPorcentual);
        EditNotaNeta.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditNotaNetaKeyPressed(evt);
            }
        });

        jLabel10.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel10.setText("Nota neta:");

        jLabel16.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel16.setText("Nota porcentual:");

        EditNotaPorcentual.setNextFocusableComponent(EditFecha);
        EditNotaPorcentual.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditNotaPorcentualKeyPressed(evt);
            }
        });

        EditFecha.setNextFocusableComponent(Cancelar);
        EditFecha.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditFechaKeyPressed(evt);
            }
        });

        jLabel17.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel17.setText("Fecha:");

        jLabel19.setForeground(new java.awt.Color(255, 0, 0));
        jLabel19.setText("*");
        jLabel19.setToolTipText("Campo Obligatorio");

        jLabel20.setForeground(new java.awt.Color(255, 0, 0));
        jLabel20.setText("*");
        jLabel20.setToolTipText("Campo Obligatorio");

        jLabel21.setForeground(new java.awt.Color(255, 0, 0));
        jLabel21.setText("*");
        jLabel21.setToolTipText("Campo Obligatorio");

        jLabel22.setForeground(new java.awt.Color(255, 0, 0));
        jLabel22.setText("*");
        jLabel22.setToolTipText("Campo Obligatorio");

        EditActividad.setFont(new java.awt.Font("Arial", 0, 12));
        EditActividad.setNextFocusableComponent(Descripcion);
        EditActividad.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditActividadKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout PanelEdicionLayout = new javax.swing.GroupLayout(PanelEdicion);
        PanelEdicion.setLayout(PanelEdicionLayout);
        PanelEdicionLayout.setHorizontalGroup(
            PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelEdicionLayout.createSequentialGroup()
                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelEdicionLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel19))
                    .addComponent(jLabel20, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelEdicionLayout.createSequentialGroup()
                        .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(PanelEdicionLayout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addGap(31, 31, 31))
                            .addGroup(PanelEdicionLayout.createSequentialGroup()
                                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel8)
                                    .addComponent(jLabel6))
                                .addGap(18, 18, 18)))
                        .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
                            .addComponent(EditCursoUnidad, javax.swing.GroupLayout.Alignment.LEADING, 0, 263, Short.MAX_VALUE)
                            .addGroup(PanelEdicionLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(EditActividad, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE))))
                    .addGroup(PanelEdicionLayout.createSequentialGroup()
                        .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel16)
                            .addComponent(jLabel17)
                            .addComponent(jLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(EditFecha, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
                            .addComponent(EditNotaNeta, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
                            .addComponent(EditNotaPorcentual, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE))))
                .addContainerGap())
        );
        PanelEdicionLayout.setVerticalGroup(
            PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelEdicionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(EditActividad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(EditCursoUnidad))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel9)
                        .addComponent(jLabel19))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(EditNotaNeta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(EditNotaPorcentual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21))
                .addGap(8, 8, 8)
                .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelEdicionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel17)
                        .addComponent(jLabel22))
                    .addComponent(EditFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(21, 21, 21))
        );

        CRUDiNota.addTab("Editar", PanelEdicion);

        ReporteNota.setFont(new java.awt.Font("Arial", 0, 12));
        ReporteNota.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        ReporteNota.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ReporteNotaMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(ReporteNota);

        jLabel24.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel24.setText("Buscar:");

        BuscarX.setFont(new java.awt.Font("Arial", 0, 12));
        BuscarX.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todas las notas" }));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BuscarX, 0, 323, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(BuscarX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                .addContainerGap())
        );

        CRUDiNota.addTab("Reporte", jPanel2);

        Cancelar.setText("Cancelar");
        Cancelar.setNextFocusableComponent(Aceptar);
        Cancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CancelarActionPerformed(evt);
            }
        });
        Cancelar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                CancelarKeyPressed(evt);
            }
        });

        Aceptar.setText("Aceptar");
        Aceptar.setNextFocusableComponent(CRUDiNota);
        Aceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AceptarActionPerformed(evt);
            }
        });
        Aceptar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                AceptarKeyPressed(evt);
            }
        });

        com.l2fprod.common.swing.PercentLayout percentLayout1 = new com.l2fprod.common.swing.PercentLayout();
        percentLayout1.setGap(14);
        percentLayout1.setOrientation(1);
        jTaskPane1.setLayout(percentLayout1);

        jLabel23.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel23.setForeground(new java.awt.Color(255, 255, 255));
        jLabel23.setText("Control de Notas");
        jTaskPane1.add(jLabel23);

        Desc.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        Desc.setForeground(new java.awt.Color(255, 255, 255));
        jTaskPane1.add(Desc);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTaskPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(CRUDiNota, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(Cancelar)
                        .addGap(18, 18, 18)
                        .addComponent(Aceptar)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jTaskPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(CRUDiNota, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(Aceptar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Cancelar))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
//<editor-fold defaultstate="collapsed" desc="Componentes">
    private void jLabel1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jLabel1FocusGained
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel1FocusGained

    private void ActividadKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ActividadKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            this.Descripcion.requestFocusInWindow();
        }
}//GEN-LAST:event_ActividadKeyPressed

    private void FechaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_FechaKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            this.NotaPorcentual.requestFocusInWindow();
        }
}//GEN-LAST:event_FechaKeyPressed

    private void jLabel11FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jLabel11FocusGained
        // TODO add your handling code here:
}//GEN-LAST:event_jLabel11FocusGained

    private void DescripcionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_DescripcionKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            this.NotaNeta.requestFocusInWindow();
        }
}//GEN-LAST:event_DescripcionKeyPressed

    private void NotaNetaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_NotaNetaKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            this.NotaPorcentual.requestFocusInWindow();
        }
}//GEN-LAST:event_NotaNetaKeyPressed

    private void NotaPorcentualKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_NotaPorcentualKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            this.Aceptar.requestFocusInWindow();
            this.Fecha.getCalendarButton().doClick();
        }
}//GEN-LAST:event_NotaPorcentualKeyPressed

    private void jLabel6FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jLabel6FocusGained
        // TODO add your handling code here:
}//GEN-LAST:event_jLabel6FocusGained

    private void EditDescripcionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditDescripcionKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            this.EditNotaNeta.requestFocusInWindow();
        }
}//GEN-LAST:event_EditDescripcionKeyPressed

    private void EditNotaNetaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditNotaNetaKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            this.NotaPorcentual.requestFocusInWindow();
        }
}//GEN-LAST:event_EditNotaNetaKeyPressed

    private void EditNotaPorcentualKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditNotaPorcentualKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            this.Aceptar.requestFocusInWindow();
            this.EditFecha.getCalendarButton().doClick();
        }
}//GEN-LAST:event_EditNotaPorcentualKeyPressed

    private void EditFechaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditFechaKeyPressed
        // TODO add your handling code here:
}//GEN-LAST:event_EditFechaKeyPressed

    private void CancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelarActionPerformed
        // TODO add your handling code here:
        Cancelar();
}//GEN-LAST:event_CancelarActionPerformed

    private void CancelarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_CancelarKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            Cancelar();
        }
}//GEN-LAST:event_CancelarKeyPressed

    private void AceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AceptarActionPerformed
        // TODO add your handling code here:
        Aceptar();
}//GEN-LAST:event_AceptarActionPerformed

    private void AceptarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_AceptarKeyPressed
        // TODO add your handling code here:
        if(evt.getKeyCode()==10){
            Aceptar();
        }
}//GEN-LAST:event_AceptarKeyPressed

    private void CRUDiNotaStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_CRUDiNotaStateChanged
        // TODO add your handling code here:
        if(haydatos){
            if(this.CRUDiNota.getSelectedIndex()==2){
                this.Desc.setText("Reporte de todas las notas, los campos con * son obligatorios");
                this.Aceptar.setEnabled(false);
                this.Cancelar.setEnabled(false);
            }else if(this.CRUDiNota.getSelectedIndex()==0){
                this.Desc.setText("Creacion de nuevas notas, los campos con * son obligatorios");
                this.Aceptar.setEnabled(true);
                this.Cancelar.setEnabled(true);
            }else {
                this.Desc.setText("Edicion de las notas ya existentes, los campos con * son obligatorios");
                this.Aceptar.setEnabled(true);
                this.Cancelar.setEnabled(true);
            }
        }else{
            this.CRUDiNota.setSelectedIndex(0);
        }        
    }//GEN-LAST:event_CRUDiNotaStateChanged

    private void EditCursoUnidadItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_EditCursoUnidadItemStateChanged
        // TODO add your handling code here:
        if(ban==1){
            //CargarDatosNotas();
        }
}//GEN-LAST:event_EditCursoUnidadItemStateChanged

    private void EditActividadKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditActividadKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_EditActividadKeyPressed

    private void ReporteNotaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ReporteNotaMouseClicked
        // TODO add your handling code here:
         if(evt.getClickCount()==2){
            id=Short.parseShort(ids.get(this.ReporteNota.getSelectedRow()).toString());
            CargarDatosNota();
            this.CRUDiNota.setSelectedIndex(1);
         }
    }//GEN-LAST:event_ReporteNotaMouseClicked
//</editor-fold>
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try
                {
                //Correcion hecha por Chuster Boy ;)
                    UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
                }
                catch (Exception e)
                {
                    e.printStackTrace();
                }
                ControlNotas dialog = new ControlNotas(new javax.swing.JFrame(), true,(short)1);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Aceptar;
    private javax.swing.JTextField Actividad;
    private javax.swing.JComboBox BuscarX;
    private javax.swing.JTabbedPane CRUDiNota;
    private javax.swing.JButton Cancelar;
    private javax.swing.JComboBox CursoUnidad;
    private javax.swing.JLabel Desc;
    private javax.swing.JTextArea Descripcion;
    private javax.swing.JTextField EditActividad;
    private javax.swing.JComboBox EditCursoUnidad;
    private javax.swing.JTextArea EditDescripcion;
    private com.toedter.calendar.JDateChooser EditFecha;
    private javax.swing.JSpinner EditNotaNeta;
    private javax.swing.JSpinner EditNotaPorcentual;
    private com.toedter.calendar.JDateChooser Fecha;
    private javax.swing.JSpinner NotaNeta;
    private javax.swing.JSpinner NotaPorcentual;
    private javax.swing.JPanel PanelCreacion;
    private javax.swing.JPanel PanelEdicion;
    private javax.swing.JTable ReporteNota;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private com.l2fprod.common.swing.JTaskPane jTaskPane1;
    // End of variables declaration//GEN-END:variables

}
